<?php
// ### AclAssistant : Community
class Action_Community_CreateDocType extends RL_Handler
{
	
	public function process ()
	{
		
		$view = $this->rh->views->findByName('createtdi');
		
		$acl_assistant = $this->module->aa;
		$this->ctx->db->begin();
		$adata = $acl_assistant->getInfo();
		
		if (isset($this->rh->GET['isform'])) {
		
		$cname = $this->rh->GET['title'];
		$tdi_type = $this->rh->GET['tdi_type'];
		$color = $this->rh->GET['color'];
		$url = $this->rh->GET['url'];

		$community_oid = $adata['comity_oid'];
		
			if ( $tdi_oid = $acl_assistant->createTdi( $url, $community_oid, $cname, $tdi_type, $color ) ) {
				$view->data['message'] = "Создал раздел ".$cname;
			}
			
		} else {  
			
			$view->data['message'] = "Передайте ч/з GET название типа документа и его типа, через переменные name и type.";
		}
		
		$this->rh->response->setContent($view);

		$this->ctx->db->end();
	} // end of function process

}

